package com.lvmama.pangolin.hotel.service.impl;

import com.lvmama.pangolin.mybatis.mapper.hotel.HotelProductDetailMapper;
import com.lvmama.pangolin.entity.ProductConditionVO;
import com.lvmama.pangolin.entity.hotel.HotelPdetail;
import com.lvmama.pangolin.entity.hotel.HotelProductDetail;
import com.lvmama.pangolin.hotel.service.HotelProductDetailService;
import com.github.pagehelper.PageHelper;
import com.lvmama.pangolin.core.AbstractService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;


/**
 * Created by zhoutianqi on 2017/08/15.
 */
@Service
@Transactional
public class HotelProductDetailServiceImpl extends AbstractService<HotelProductDetail> implements HotelProductDetailService {
    @Autowired
    private HotelProductDetailMapper hotelProductDetailMapper;

	@Override
	public int saveHotelPdetail(HotelPdetail t) {
		// TODO Auto-generated method stub
		return hotelProductDetailMapper.saveHotelPdetail(t);
	}

	@Override
	public int updateHotelPdetail(HotelPdetail t) {
		// TODO Auto-generated method stub
		return hotelProductDetailMapper.updateHotelPdetail(t);
	}

	@Override
	public int updateByProd(HotelProductDetail t)
	{
		return hotelProductDetailMapper.updateByProd(t);
	}
	@Override
	public List<HotelProductDetail> findByString(String companyCode,String productName) {
		return hotelProductDetailMapper.findByString(companyCode,productName);
	}

	@Override
	public List<HotelProductDetail> findByProductVO(ProductConditionVO po) {
		PageHelper.startPage(po.getPage(), po.getPageSize());
		return hotelProductDetailMapper.findByProductVO(po);
	}

	@Override
	public void setIsLinkd(String companyCode, String productId) {
		hotelProductDetailMapper.setIsLinkd(companyCode, productId);
	}

	@Override
	public void deleteLinkd(String companyCode, String productId) {
		hotelProductDetailMapper.deleteLinkd(companyCode, productId);		
	}

	@Override
	public HotelProductDetail findByProductId(String productId,String companyCode) {
		return hotelProductDetailMapper.findByProductId(productId,companyCode);
	}

	@Override
	public List<HotelProductDetail> findAllByProductVO(ProductConditionVO po) {
		return hotelProductDetailMapper.findByProductVO(po);
	}

	@Override
	public List<HotelProductDetail> findByCompanyUrl(String companyCode, String detailUrl) {
		// TODO Auto-generated method stub
		return hotelProductDetailMapper.findByCompanyUrl(companyCode, detailUrl);
	}
}
